<template>
  <el-dialog title="超时订单处理" :visible.sync="visible" append-to-body width="600px">
    <el-form :model="form" ref="form">
      <el-form-item label="超时原因" prop="content" :rules="[{
        required: true, message: '请填写超时原因', trigger: 'blur'
      }]">
        <el-input type="textarea" v-model="form.content" rows="5" autocomplete="off"></el-input>
      </el-form-item>
      
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取 消</el-button>
      <el-button type="primary" @click="submit">提 交</el-button>
    </div>
  </el-dialog>
</template>

<script>
import {
  disposeOvertimeOrder,
} from "@/api/transfer";

export default {
  data() {
    return {
      visible: false,
      dataInfo: {},
      form: {
        content: ''
      }
    };
  },
  methods: {
    show({data}) {
      this.visible = true
      this.dataInfo = data
    },
    submit() {
      this.$refs.form.validate(valid => {
        if (valid) {
          const params = {
            orderId: this.dataInfo.id,
            content: this.form.content
          }
          disposeOvertimeOrder(params).then(res => {
            if(res.data.code == 200) {
              this.$message({
                type: 'success',
                message: '处理成功',
              })
              this.visible = false
              this.$emit('fetch')
            }
          })
        }
      })
    }
  }
};
</script>
<style lang="scss" scoped>

</style>